package han.chensing.latos.maker.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexUtil {
    public static String replaceField(String input,String field,String to){
        Pattern pattern=Pattern.compile(
                String.format("(?<=(%s=))(.)+(?=;)",field));
        Matcher matcher = pattern.matcher(input);
        if (!matcher.find())
            return input;
        String group = matcher.group();
        if (group==null)
            return input;
        return matcher.replaceAll(to);
    }
}
